package com.threeonemeeting.activity;

import java.util.Map;

import com.snda.lib.http.HttpConst;
import com.snda.lib.http.HttpUtil;
import com.snda.lib.http.ICallBack;
import com.threeonemeeting.tab.BaseTabActivity;

/**
 * @desc 所有的需要处理Callback的都从 CallBackActivity继承
 * 
 */
public class CallBackActivity extends BaseTabActivity implements ICallBack {

	// 
	public void onFailedCallBack(Map<String, Object> mapData) {

	}

	public void onSuccessCallBack(Map<String, Object> mapData) {

	}

	public void doCallBack(Map<String, Object> mapData) {

		Integer msgType = (Integer) mapData.get(HttpConst.KEY_TASK_TYPE);
		if (msgType == null) {
			return;
		}

		Integer nError = (Integer) mapData.get(HttpUtil.KEY_ERROR_CODE);
		if (nError == null || nError != HttpUtil.ERROR_SUCCESS) {
			onFailedCallBack(mapData);
			return;
		}

		onSuccessCallBack(mapData);
	}
}
